<#import "spring.ftl" as spring />
<#import "inspector-time-macros.ftl" as imacro />
<html>
<head>
	<title>my.edificetraining.com: Inspector Registration</title>
</head>
<body>

<script type="text/javascript" src="${springMacroRequestContext.contextPath}/js/wz_tooltip.js"></script>

<div id="content">

	<#if add??>
		<#if scheduler??>
			<form action="addScheduler.html" method="post">
		<#else>		
			<form action="addInspector.html" method="post">
		</#if>
	<#else>
		<form action="register.html" method="post">
	</#if>
	
	<#if add??>
		<#if scheduler??>
			<h1>ADD SCHEDULER</h1> 
			
			<p>Please fill out the fields below to add the details of someone associated with your company 
		       who is responsible for scheduling your inspections.</p>
		   
		<#else>		
			<h1>ADD INSPECTOR</h1> 
			
			<p>Please fill out the fields below to add another inspector's information to your company.  
			   This inspector's open time slots will show up in the list of available times that a Home Buyer
			   can select from.
			</p>
		</#if>
	<#else>
		<h1>INSPECTOR REGISTRATION</h1>
		
		<p>Please fill out the fields below to register your company with Inspector Time at no cost, and enjoy
		   the benefits of online inspection management and 24/7 inspection booking.
		</p>
	</#if>
	
	<#if add?? >
		<p>
		COMPANY INFO:<br />
		${employee.company.name} (${employee.company.shortName})<br/>
		${employee.company.address.street1}<br />
		${employee.company.address.city}, ${employee.company.address.state} ${employee.company.address.zipCode}<br />
		</p>
	</#if>

	<@imacro.listErrors "employee" />

<#if add?? >
	<#if scheduler??>
		<form action="addScheduler.html" method="post">
	<#else>		
		<form action="addInspector.html" method="post">
	</#if>
<#else>
	<form action="register.html" method="post">
</#if>

	<table class="formTable twoColForm">
		<tr>
			<th><span class="required">*</span>First Name</th>
			<td><@spring.formInput "employee.name.first", 'size="25"'/></td>
		</tr>
		<tr>
			<th><span class="required">*</span>Last Name</th>
			<td><@spring.formInput "employee.name.last", 'size="25"'/></td>
		</tr>

	<#if add??>
	
		<tr>
			<th><span class="required">*</span>Email Address</th>
			<td><@spring.formInput "employee.email", 'size="25", maxlength="100"'/></td>
		</tr>
		<tr>
			<th><span class="required">*</span>Confirm Email Address</th>
			<td><@spring.formInput "employee.emailConfirm", 'size="25", maxlength="100"'/></td>
		</tr>
		<tr>
			<th><span class="required">*</span>Personal Phone</th>
			<td><@spring.formInput "employee.phone", 'size="15", maxlength="20"'/></td>
		</tr>
		<tr>
			<th><span class="required">*</span>Username</th>
			<td><@spring.formInput "employee.userName", 'size="10", maxlength="50"'/></td>
		</tr>
		<tr>
			<th><span class="required">*</span>Password</th>
			<td><@spring.formPasswordInput "employee.password", 'size="15", maxlength="28"'/></td>
		</tr>

		<@spring.formHiddenInput "employee.company.name" />
		<@spring.formHiddenInput "employee.company.address.street1" />
		<@spring.formHiddenInput "employee.company.address.city" />
		<@spring.formHiddenInput "employee.company.address.state" />
		<@spring.formHiddenInput "employee.company.address.zipCode" />
		<@spring.formHiddenInput "employee.company.shortName"/>
		<@spring.formHiddenInput "employee.company.companyPhone"/>
		<@spring.formHiddenInput "employee.company.maxMilesServed"/>
			
		
	<#else>
	
		<tr>
			<th><span class="required">*</span>Company Name</th>
			<td><@spring.formInput "employee.company.name", 'size="35", maxlength="100"'/></td>
		</tr>
		<tr>
			<th><span class="required">*</span>Company Address</th>
			<td><@spring.formInput "employee.company.address.street1", 'size="35", maxlength="100"'/></td>
		</tr>
		<tr>
			<th><span class="required">*</span>Company City</th>
			<td><@spring.formInput "employee.company.address.city", 'size="25", maxlength="100"'/></td>
		</tr>
		<tr>
			<th><span class="required">*</span>Company State</th>
			<td>
				<@spring.bind "employee.company.address.state" />
				 <select id="${spring.status.expression}" name="${spring.status.expression}">
			    	<option value=""<@spring.checkSelected ""/>>-- SELECT STATE --</option>
				    <#list states as option>
			    		<option value="${option}"<@spring.checkSelected option/>>${option.longName}</option>
			        </#list>
				</select>
			</td>
		</tr>
		<tr>
			<th><span class="required">*</span>Company Zip</th>
			<td><@spring.formInput "employee.company.address.zipCode", 'size="10", maxlength="10"'/></td>
		</tr>
		<tr>
			<th><span class="required">*</span>Company Shortname <a href="#" onmouseover="TagToTip('shortnameTip');" onmouseout="UnTip()" onclick="return false;" class="whatsthis">what's this?</a></th>
			<td><@spring.formInput "employee.company.shortName", 'size="10", maxlength="50"'/></td>
		</tr>
		<tr>
			<th><span class="required">*</span>Inspection Fee <div class="labelSubtext">(can be changed later)</div></th>
			<td><@spring.formInput "employee.company.baseInspectionFee", 'size="10", maxlength="13"'/></td>
		</tr>
		<tr>
			<th><span class="required">*</span>Max Miles Served</th>
			<td><@spring.formInput "employee.company.maxMilesServed", 'size="10", maxlength="3"'/></td>
		</tr>
		<tr>
			<th><span class="required">*</span>Email Address</th>
			<td><@spring.formInput "employee.email", 'size="25", maxlength="100"'/></td>
		</tr>
		<tr>
			<th><span class="required">*</span>Confirm Email Address</th>
			<td><@spring.formInput "employee.emailConfirm", 'size="25", maxlength="100"'/></td>
		</tr>
		<tr>
			<th><span class="required">*</span>Personal Phone</th>
			<td><@spring.formInput "employee.phone", 'size="15", maxlength="20"'/></td>
		</tr>
		<tr>
			<th>Company Phone <div class="labelSubtext">(what home buyers call)</div></th>
			<td><@spring.formInput "employee.company.companyPhone", 'size="15", maxlength="20"'/></td>
		</tr>
		<tr>
			<th><span class="required">*</span>Username</th>
			<td><@spring.formInput "employee.userName", 'size="10", maxlength="50"'/></td>
		</tr>
		<tr>
			<th><span class="required">*</span>Password</th>
			<td><@spring.formPasswordInput "employee.password", 'size="15", maxlength="28"'/></td>
		</tr>
		
	</#if>
	
	<tr>
		<td colspan="2" class="buttons">
		<#if add?? >
			<input type="submit" value="SAVE" class="formButton"/>
			<a href="settings.html" class="formLink">-CANCEL-</a>
		<#else>
			<input type="submit" value="REGISTER" class="formButton"/>
			<a href="index.html" class="formLink">-CANCEL-</a>
		</#if>
		</td>
	</tr>
</table>
	
	<div class="requiredText">*INDICATES REQUIRED FIELDS</div>

<#-- Hide this div if we're not registering a first time user, since the tooltip javascript won't hide it if it can't find the tooltip href -->
<#if !add??>
	<div id="shortnameTip"><div class="toolTipWindow">For company shortname, please enter a 3 to 8 character abbreviation of your company's name, with no spaces or symbols. 
              			   This will be included within the custom url that directs users to your schedule.</div></div>
</#if>
</form>
</div>
</body>
</html>
